<template>
	<view class="content page-set">
		
			<u-tabs :list="list"  :is-scroll="false" active-color="#F24646" :current="current" @change="change"></u-tabs>
			<view class="line"></view>
		<view class="content-top">
			<view class=' ' v-for="(item,index) in dataList" :key="index">
				<template v-if="current==0">
					<view class="u-flex u-f-justify fz12 c9 mt12 mb12">
						{{item.createTimeFormat}}
					</view>
					<view class='p15 bg-white'>
						<view class='fz14 c3'>{{item.templateNickname}}</view>
						<view class='fz12 c9 mt10' v-html="item.templateContent"></view>
					</view>
				</template>
				<template v-if="current==1">
					<view class="u-flex u-f-justify fz12 c9 mt12 mb12">
						{{item.createTime}}
					</view>
					<view class='p15 bg-white'>
						<view class='fz14 c3'>{{item.title}}</view>
						<view class='fz12 c9 mt10' v-html="item.content"></view>
					</view>
				</template>
			</view>
			
		</view>
		
	</view>
</template>

<script>
	export default {

		data() {
			return {
				current: 0,
				list: [{
					name: '业务通知',
					id: '1',
				}, {
					name: '系统',
					id: '2'
				},],
				dataList:[],
				curType:1,
				userInfo: {},
			}
		},
		onShareAppMessage(e) {},
		// #ifdef MP-WEIXIN
		onShareTimeline() {
			return this.mpShare
		},
		// #endif
		onLoad(e) {
			if(e.type){
				this.curType=e.type
			}
			this.getData()
		},
		methods: {
			
			change(e) {
					this.dataList=[]
				this.current = e
				this.getData()
			},
			getData(){
				if(this.current==0){
					
						this.$api.msgList({
							type:1,
							pageNo: 1,
							pageSize: 500
						}, res => {
							if (res.code==200) {
								this.dataList= res.data.list
							}
						})
				}else{
					
						this.$api.noticeList({
							type:2,
							pageNo: 1,
							pageSize: 500
						}, res => {
							if (res.code==200) {
								this.dataList= res.data.list
							}
						})
				}
				
			}
		}
	}
</script>

<style lang="scss">
	page{
		background: #f5f5f5;
	}
</style>